package com.czl.dxpro.dx_05_TopN;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import com.czl.dxpro.dx_04_utils.TProperties;

public class DxTopNMapper extends Mapper<LongWritable, Text, Text, Text>{
	private String topkey = "1";
	private Text okey = new Text();
	//获取分组字段位置
	
	//以分组字段为key
	@Override
	public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
		String[] values = value.toString().split(TProperties.getValue("fileoutsplit"));
		okey = new Text(values[Integer.parseInt(topkey)]);
		//按用户分组
		context.write(okey, value);
	}
}
